//
//  AboutAnxinViewController.m
//  AnXin100
//
//  Created by Sakura on 2018/10/31.
//  Copyright © 2018 tzhg. All rights reserved.
//    

#import "AboutAnxinViewController.h"
#import "UIViewController+HBD.h"

@interface AboutAnxinViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *mainTable;
@property (nonatomic, strong) NSArray *array;
@end

@implementation AboutAnxinViewController

- (void)viewDidLoad {
    [self setupNavigationItems];
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [PublicMonMethods setupNavigationItems:self];
    [PublicMonMethods settitle:@"关于安心100" viewController:self];
    
    [self.view addSubview:self.mainTable];
    _array = @[@"版权信息", @"软件使用许可协议", @"安心100平台服务协议", @"隐私权政策", @"说明", @"联系电话"];
    self.hbd_barTintColor = [UIColor whiteColor];
    
    
    
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, Hn, SCREEN_WIDTH, 150)];
    headView.backgroundColor = [UIColor whiteColor];
    _mainTable.tableHeaderView = headView;
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 95, 95)];
    imageView.center = headView.center;
    imageView.image = [UIImage imageNamed:@"aboutAnxin"];
    [headView addSubview:imageView];
    
    
}


- (void)setupNavigationItems {
    
    self.hbd_barTintColor = [UIColor whiteColor];
    self.hbd_barShadowHidden = YES;
    
    //返回按钮
    UIButton *kfBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [kfBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    kfBtn.frame = CGRectMake(0, 0, 30, 30);
    [kfBtn addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithCustomView:kfBtn];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    /** title */
    UILabel *titleLabel = [[UILabel alloc]init];
    titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 30)];
    titleLabel.text = @"关于安心100";
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = FONT_EIGHTEEN;
    titleLabel.textColor = [UIColor colorWithHex:0x29b566];
    self.navigationItem.titleView = titleLabel;
    
}

- (void)backAction:(UIBarButtonItem *)item {
    
    [self.navigationController popViewControllerAnimated:YES];
}


- (UITableView *)mainTable {
    if (!_mainTable) {
        _mainTable = [[UITableView alloc] initWithFrame:CGRectMake(0, Hn, SCREEN_WIDTH, SCREEN_HEIGHT - Hn) style:UITableViewStylePlain];
        _mainTable.delegate = self;
        _mainTable.dataSource = self;
        _mainTable.separatorStyle = UITableViewCellSelectionStyleNone;
    }
    return _mainTable;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"UITableViewCell"];
    }
    
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = _array[indexPath.row];
    cell.textLabel.font = FONT_FOURTEEN;
    cell.textLabel.textColor = [UIColor colorWithHex:0x333333];
    cell.textLabel.text = _array[indexPath.row];
    if (indexPath.row == _array.count - 1) {
        cell.detailTextLabel.text = @"0871-68383838";
    }
    return cell;
}



@end
